<!doctype html>



  


<html class="theme-next pisces use-motion">
<head>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-PBHRK7');</script>
<!-- End Google Tag Manager -->
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.4.0" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.0.2" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="前端 知识 面试," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.0.2" />






<meta name="description" content="基础提醒1234567if([] == false) console.log(&apos;1&apos;);if(&amp;#123;&amp;#125; == false) console.log(&apos;2&apos;);if(![]) console.log(&apos;3&apos;);if([1] == [1]) console.log(&apos;4&apos;);会输出那些答案： 输出1 算法是: 给定一个 data 数组，然后取出 n 个数，让他们相加等于 sum，输出这">
<meta name="keywords" content="前端 知识 面试">
<meta property="og:type" content="article">
<meta property="og:title" content="前端面试《第二十篇》 大厂问题2">
<meta property="og:url" content="http://wurh.github.io/2019/04/06/201904060843/index.html">
<meta property="og:site_name" content="华Ing&#39;s blog">
<meta property="og:description" content="基础提醒1234567if([] == false) console.log(&apos;1&apos;);if(&amp;#123;&amp;#125; == false) console.log(&apos;2&apos;);if(![]) console.log(&apos;3&apos;);if([1] == [1]) console.log(&apos;4&apos;);会输出那些答案： 输出1 算法是: 给定一个 data 数组，然后取出 n 个数，让他们相加等于 sum，输出这">
<meta property="og:locale" content="en">
<meta property="og:updated_time" content="2019-07-12T06:10:38.193Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="前端面试《第二十篇》 大厂问题2">
<meta name="twitter:description" content="基础提醒1234567if([] == false) console.log(&apos;1&apos;);if(&amp;#123;&amp;#125; == false) console.log(&apos;2&apos;);if(![]) console.log(&apos;3&apos;);if([1] == [1]) console.log(&apos;4&apos;);会输出那些答案： 输出1 算法是: 给定一个 data 数组，然后取出 n 个数，让他们相加等于 sum，输出这">



<script type="text/javascript" id="hexo.configuration">
  var NexT = window.NexT || {};
  var CONFIG = {
    scheme: 'Pisces',
    sidebar: {"position":"left","display":"post"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: 'Author'
    }
  };
</script>




  <link rel="canonical" href="http://wurh.github.io/2019/04/06/201904060843/"/>


  <title> 前端面试《第二十篇》 大厂问题2 | 华Ing's blog </title>
</head>

<body itemscope itemtype="//schema.org/WebPage" lang="en">
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-PBHRK7"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

  










  
  
    
  

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-69412379-1', 'auto');
  ga('send', 'pageview');

</script>

  <script>
  var _hmt = _hmt || [];
  (function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b3ddfb8655d8b77429e04c7a4d5bcbc1";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
  })();
  </script>


  <div class="container one-collumn sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="//schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta ">
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">华Ing's blog</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle">harder and harder</p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
            Home
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
            Categories
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
            Archives
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
            Tags
          </a>
        </li>
      

      
    </ul>
  

  
</nav>

 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  
  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="//schema.org/Article">

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                前端面试《第二十篇》 大厂问题2
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            <span class="post-meta-item-icon">
              <i class="fa fa-calendar-o"></i>
            </span>
            <span class="post-meta-item-text">Posted on</span>
            <time itemprop="dateCreated" datetime="2019-04-06T06:05:16+08:00" content="2019-04-06">
              2019-04-06
            </time>
          </span>

          
            <span class="post-category" >
              &nbsp; | &nbsp;
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">In</span>
              
                <span itemprop="about" itemscope itemtype="https://schema.org/Thing">
                  <a href="/categories/前端面试/" itemprop="url" rel="index">
                    <span itemprop="name">前端面试</span>
                  </a>
                </span>

                
                

              
            </span>
          

          
            
              <span class="post-comments-count">
                &nbsp; | &nbsp;
                <a href="/2019/04/06/201904060843/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2019/04/06/201904060843/" itemprop="commentsCount"></span>
                </a>
              </span>
            
          

          

          
          

          
        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <h3 id="基础提醒"><a href="#基础提醒" class="headerlink" title="基础提醒"></a>基础提醒</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">if</span>([] == <span class="literal">false</span>) <span class="built_in">console</span>.log(<span class="string">'1'</span>);</span><br><span class="line"><span class="keyword">if</span>(&#123;&#125; == <span class="literal">false</span>) <span class="built_in">console</span>.log(<span class="string">'2'</span>);</span><br><span class="line"><span class="keyword">if</span>(![]) <span class="built_in">console</span>.log(<span class="string">'3'</span>);</span><br><span class="line"><span class="keyword">if</span>([<span class="number">1</span>] == [<span class="number">1</span>]) <span class="built_in">console</span>.log(<span class="string">'4'</span>);</span><br><span class="line">会输出那些</span><br><span class="line"></span><br><span class="line">答案： 输出<span class="number">1</span></span><br></pre></td></tr></table></figure>
<h3 id="算法是-给定一个-data-数组，然后取出-n-个数，让他们相加等于-sum，输出这n个数，并说出时间复杂度-回溯法练习"><a href="#算法是-给定一个-data-数组，然后取出-n-个数，让他们相加等于-sum，输出这n个数，并说出时间复杂度-回溯法练习" class="headerlink" title="算法是: 给定一个 data 数组，然后取出 n 个数，让他们相加等于 sum，输出这n个数，并说出时间复杂度 (回溯法练习)"></a>算法是: 给定一个 data 数组，然后取出 n 个数，让他们相加等于 sum，输出这n个数，并说出时间复杂度 (回溯法练习)</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//input [2,3,5,7]</span></span><br><span class="line"></span><br><span class="line"><span class="comment">//target 7</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">let</span> arr1 = [];</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">cominationSum</span> (<span class="params">arr,target,number</span>)</span>&#123;</span><br><span class="line"></span><br><span class="line">  <span class="comment">//进行数组去重</span></span><br><span class="line">  <span class="keyword">let</span> arr2 = <span class="keyword">new</span> <span class="built_in">Set</span>(arr);  </span><br><span class="line">  arr = [...arr2];</span><br><span class="line"></span><br><span class="line">  <span class="comment">//先进性排序</span></span><br><span class="line">  arr=arr.sort(<span class="function"><span class="keyword">function</span>(<span class="params">a,b</span>)</span>&#123;</span><br><span class="line">  	<span class="keyword">return</span> a-b;</span><br><span class="line">  &#125;)</span><br><span class="line">  </span><br><span class="line">  getNumber(arr, target,[],<span class="number">0</span>,number)</span><br><span class="line">  <span class="keyword">return</span> arr1;</span><br><span class="line">  </span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">//获取数子组合方法</span></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">getNumber</span>(<span class="params">arr,target,list,index,number</span>)</span>&#123;</span><br><span class="line">	<span class="keyword">if</span>(target == <span class="number">0</span> &amp;&amp; list.length == number)&#123;</span><br><span class="line">	    <span class="keyword">let</span> val = list.join(<span class="string">','</span>);</span><br><span class="line">		arr1.push(val.split(<span class="string">','</span>))</span><br><span class="line">	&#125;</span><br><span class="line">	</span><br><span class="line">	<span class="keyword">for</span>(<span class="keyword">let</span> i = index; i&lt;arr.length; i++)&#123;</span><br><span class="line">		<span class="keyword">if</span>(arr[i] &lt; target+<span class="number">1</span>)&#123;</span><br><span class="line">			list.push(arr[i]);</span><br><span class="line">			<span class="comment">//console.log(list)</span></span><br><span class="line">			getNumber(arr, target-arr[i], list, i+<span class="number">1</span>,number);</span><br><span class="line">			list.pop();</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;</span><br><span class="line">			</span><br><span class="line">	&#125;</span><br><span class="line"><span class="keyword">let</span> result1 = cominationSum([<span class="number">2</span>,<span class="number">3</span>,<span class="number">5</span>,<span class="number">7</span>,<span class="number">10</span>,<span class="number">22</span>,<span class="number">3</span>,<span class="number">51</span>,<span class="number">2</span>,<span class="number">4</span>,<span class="number">56</span>,<span class="number">2</span>,<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>,<span class="number">4</span>,<span class="number">1</span>,<span class="number">2</span>,<span class="number">2</span>,<span class="number">1</span>,<span class="number">2</span>],<span class="number">6</span>,<span class="number">2</span>)</span><br><span class="line"></span><br><span class="line"><span class="built_in">console</span>.log(result1);</span><br></pre></td></tr></table></figure>
<h3 id="请看下面提醒，输出打印顺序"><a href="#请看下面提醒，输出打印顺序" class="headerlink" title="请看下面提醒，输出打印顺序"></a>请看下面提醒，输出打印顺序</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="keyword">async</span> func1() &#123;</span><br><span class="line">  <span class="built_in">console</span>.log(<span class="string">'1'</span>);</span><br><span class="line">  <span class="keyword">await</span> func2();</span><br><span class="line">  <span class="built_in">console</span>(<span class="string">'2'</span>);</span><br><span class="line">&#125;;</span><br><span class="line"></span><br><span class="line"><span class="keyword">async</span> func2() &#123;</span><br><span class="line">  <span class="built_in">console</span>(<span class="string">'3'</span>);</span><br><span class="line">&#125;;</span><br><span class="line"></span><br><span class="line">setTimeout(<span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>&#123;</span><br><span class="line">  <span class="built_in">console</span>.log(<span class="string">'4'</span>);</span><br><span class="line">&#125;, <span class="number">0</span>);</span><br><span class="line"></span><br><span class="line"><span class="keyword">await</span> func1();</span><br><span class="line"></span><br><span class="line"><span class="keyword">new</span> <span class="built_in">Promise</span>(<span class="function"><span class="params">resolve</span> =&gt;</span> &#123;</span><br><span class="line">  <span class="built_in">console</span>.log(<span class="string">'5'</span>);</span><br><span class="line">  resolve();</span><br><span class="line">&#125;).then(<span class="function"><span class="params">()</span> =&gt;</span> &#123;</span><br><span class="line">  <span class="built_in">console</span>.log(<span class="string">'6'</span>);</span><br><span class="line">&#125;);</span><br><span class="line"></span><br><span class="line"><span class="built_in">console</span>.log(<span class="string">'7'</span>);</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">// 1 -&gt; 3 -&gt; 5 -&gt; 7 -&gt; 6 -&gt; 2 -&gt; 4</span></span><br></pre></td></tr></table></figure>
<h4 id="请实现-function-bind-方法，使得输出为-yes"><a href="#请实现-function-bind-方法，使得输出为-yes" class="headerlink" title="请实现 function bind 方法，使得输出为 yes"></a>请实现 function bind 方法，使得输出为 yes</h4><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">A</span>(<span class="params">name, color</span>) </span>&#123;</span><br><span class="line">  <span class="keyword">this</span>.name = name;</span><br><span class="line">  <span class="keyword">this</span>.color = color;</span><br><span class="line">&#125;</span><br><span class="line">A.prototype.say = <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>&#123;</span><br><span class="line">  <span class="built_in">console</span>.log(<span class="string">`this <span class="subst">$&#123;<span class="keyword">this</span>.name&#125;</span> is <span class="subst">$&#123;<span class="keyword">this</span>.color&#125;</span>`</span>);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">// 要实现这个方法</span></span><br><span class="line"><span class="keyword">const</span> a = A.bind(<span class="literal">null</span>, <span class="string">'cat'</span>);</span><br><span class="line"><span class="keyword">const</span> b = <span class="keyword">new</span> a(<span class="string">'white'</span>);</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> (b.say() === <span class="string">'this cat is white'</span> &amp;&amp; b <span class="keyword">instanceof</span> A) &#123;</span><br><span class="line">  <span class="built_in">console</span>.log(<span class="string">'yes'</span>);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>代码逻辑如下:</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="built_in">Function</span>.prototype.bind = <span class="function"><span class="keyword">function</span>(<span class="params">context</span>)</span>&#123;</span><br><span class="line">	<span class="keyword">let</span> self = <span class="keyword">this</span>;</span><br><span class="line">	  <span class="keyword">return</span> <span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">      <span class="keyword">return</span> self.apply(context,<span class="built_in">arguments</span>)</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h4 id="19-19的棋盘，已有point-x-y-函数可以判断某个x-y位置是否有棋子，实现一个count-x-y-得到该x-y上连通棋子的数量（上下左右联通，不考虑斜角）"><a href="#19-19的棋盘，已有point-x-y-函数可以判断某个x-y位置是否有棋子，实现一个count-x-y-得到该x-y上连通棋子的数量（上下左右联通，不考虑斜角）" class="headerlink" title=". 19*19的棋盘，已有point(x,y)函数可以判断某个x,y位置是否有棋子，实现一个count(x, y)得到该x,y上连通棋子的数量（上下左右联通，不考虑斜角）"></a>. 19*19的棋盘，已有point(x,y)函数可以判断某个x,y位置是否有棋子，实现一个count(x, y)得到该x,y上连通棋子的数量（上下左右联通，不考虑斜角）</h4><h4 id="start-end-区间序列start和end，实现一个算法得到start-end-区间中所有的回文情况？如（1221，-1331等）"><a href="#start-end-区间序列start和end，实现一个算法得到start-end-区间中所有的回文情况？如（1221，-1331等）" class="headerlink" title="[start, end] 区间序列start和end，实现一个算法得到start,end 区间中所有的回文情况？如（1221， 1331等）"></a>[start, end] 区间序列start和end，实现一个算法得到start,end 区间中所有的回文情况？如（1221， 1331等）</h4><h3 id="异步加载图片时，缓存如何设计"><a href="#异步加载图片时，缓存如何设计" class="headerlink" title="异步加载图片时，缓存如何设计"></a>异步加载图片时，缓存如何设计</h3>
      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        
  <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
    <div>坚持原创技术分享，您的支持将鼓励我继续创作！</div>
    <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
      <span>赏</span>
    </button>
    <div id="QR" style="display: none;">
      
        <div id="wechat" style="display: inline-block">
          <img id="wechat_qr" src="https://wurh.github.io/images/others/weixinshou.png" alt="华Ing WeChat Pay"/>
          <p>微信打赏</p>
        </div>
      
      
        <div id="alipay" style="display: inline-block">
          <img id="alipay_qr" src="https://wurh.github.io/images/others/alifu.png" alt="华Ing Alipay"/>
          <p>支付宝打赏</p>
        </div>
      
    </div>
  </div>


      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/前端-知识-面试/" rel="tag">#前端 知识 面试</a>
          
        </div>
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2019/04/06/201904060504/" rel="next" title="前端面试《第十九篇》 大厂的问题 (第一篇)">
                <i class="fa fa-chevron-left"></i> 前端面试《第十九篇》 大厂的问题 (第一篇)
              </a>
            
          </div>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2019/07/12/201905012227/" rel="prev" title="react-mobx-实践记录">
                react-mobx-实践记录 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
        
<script>
  with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='//bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];
</script>

      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div class="ds-thread" data-thread-key="2019/04/06/201904060843/"
           data-title="前端面试《第二十篇》 大厂问题2" data-url="http://wurh.github.io/2019/04/06/201904060843/">
      </div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            Table of Contents
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            Overview
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel ">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="//schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="https://wurh.github.io/images/avatar/logo.jpg?123456"
               alt="华Ing" />
          <p class="site-author-name" itemprop="name">华Ing</p>
          <p class="site-description motion-element" itemprop="description">harder and harder</p>
        </div>
        <nav class="site-state motion-element">
          <div class="site-state-item site-state-posts">
            <a href="/archives">
              <span class="site-state-item-count">56</span>
              <span class="site-state-item-name">posts</span>
            </a>
          </div>

          
            <div class="site-state-item site-state-categories">
              <a href="/categories">
                <span class="site-state-item-count">11</span>
                <span class="site-state-item-name">categories</span>
              </a>
            </div>
          

          
            <div class="site-state-item site-state-tags">
              <a href="/tags">
                <span class="site-state-item-count">15</span>
                <span class="site-state-item-name">tags</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/wurh" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="http://weibo.com/1674582564/profile?topnav=1&wvr=6" target="_blank" title="微博">
                  
                    <i class="fa fa-fw fa-globe"></i>
                  
                  微博
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://www.zhihu.com/people/wu-rong-hua-56" target="_blank" title="知乎">
                  
                    <i class="fa fa-fw fa-globe"></i>
                  
                  知乎
                </a>
              </span>
            
          
        </div>

        
        

        
        
          <div class="links-of-blogroll motion-element links-of-blogroll-inline">
            <div class="links-of-blogroll-title">
              <i class="fa  fa-fw fa-globe"></i>
              Links
            </div>
            <ul class="links-of-blogroll-list">
              
                <li class="links-of-blogroll-item">
                  <a href="http://fsiaonma.github.io/" title="sam博客" target="_blank">sam博客</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://shenjoel.github.io/" title="joel博客" target="_blank">joel博客</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://firewood1122.github.io" title="firewood博客" target="_blank">firewood博客</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://reqianduan.com" title="热前端" target="_blank">热前端</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://opentutorial.info/" title="黄超博客" target="_blank">黄超博客</a>
                </li>
              
            </ul>
          </div>
        

      </section>

      
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">
            
              
            
            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#基础提醒"><span class="nav-number">1.</span> <span class="nav-text">基础提醒</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#算法是-给定一个-data-数组，然后取出-n-个数，让他们相加等于-sum，输出这n个数，并说出时间复杂度-回溯法练习"><span class="nav-number">2.</span> <span class="nav-text">算法是: 给定一个 data 数组，然后取出 n 个数，让他们相加等于 sum，输出这n个数，并说出时间复杂度 (回溯法练习)</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#请看下面提醒，输出打印顺序"><span class="nav-number">3.</span> <span class="nav-text">请看下面提醒，输出打印顺序</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#请实现-function-bind-方法，使得输出为-yes"><span class="nav-number">3.1.</span> <span class="nav-text">请实现 function bind 方法，使得输出为 yes</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#19-19的棋盘，已有point-x-y-函数可以判断某个x-y位置是否有棋子，实现一个count-x-y-得到该x-y上连通棋子的数量（上下左右联通，不考虑斜角）"><span class="nav-number">3.2.</span> <span class="nav-text">. 19*19的棋盘，已有point(x,y)函数可以判断某个x,y位置是否有棋子，实现一个count(x, y)得到该x,y上连通棋子的数量（上下左右联通，不考虑斜角）</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#start-end-区间序列start和end，实现一个算法得到start-end-区间中所有的回文情况？如（1221，-1331等）"><span class="nav-number">3.3.</span> <span class="nav-text">[start, end] 区间序列start和end，实现一个算法得到start,end 区间中所有的回文情况？如（1221， 1331等）</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#异步加载图片时，缓存如何设计"><span class="nav-number">4.</span> <span class="nav-text">异步加载图片时，缓存如何设计</span></a></li></ol></div>
            
          </div>
        </section>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy;  2013 - 
  <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">华Ing</span>
</div>

<div class="powered-by">
  Powered by <a class="theme-link" href="https://hexo.io">Hexo</a>
</div>

<div class="theme-info">
  Theme -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Pisces
  </a>
</div>

        

        
      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  



  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.0.2"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.0.2"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.0.2"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.0.2"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.0.2"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.0.2"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.0.2"></script>



  

  
    
  

  <script type="text/javascript">
    var duoshuoQuery = {short_name:"wurh"};
    (function() {
      var ds = document.createElement('script');
      ds.type = 'text/javascript';ds.async = true;
      ds.id = 'duoshuo-script';
      ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
      ds.charset = 'UTF-8';
      (document.getElementsByTagName('head')[0]
      || document.getElementsByTagName('body')[0]).appendChild(ds);
    })();
  </script>

  
    
    <script src="/lib/ua-parser-js/dist/ua-parser.min.js?v=0.7.9"></script>
    <script src="/js/src/hook-duoshuo.js"></script>
  






  
  

  

  

  

  


</body>
</html>
